﻿using System;
using System.Collections.Generic;
using CoreSoft.Frame.Entity;

namespace U8API.Plugin
{
    public class MesOrder
    {
        /// <summary>
        /// 制番号----生产订单号
        /// </summary>
        public string LineId { get; set; }
        /// <summary>
        /// 行号
        /// </summary>
        public string Reserved1 { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public string DocStatus { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public decimal MainQty { get; set; }
        /// <summary>
        /// 物料编码
        /// </summary>
        public string PartName { get; set; }
        /// <summary>
        /// 客户图号-----客户代号
        /// </summary>
        public string CustomerPartId { get; set; }
        /// <summary>
        /// 计划完成日期
        /// </summary>
        public DateTime PlanEndDate { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Comments { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreatedUser { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedDate { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        public string ApprovedUser { get; set; }
        /// <summary>
        /// 审核
        /// </summary>
        public DateTime ApprovedDate { get; set; }

        #region 新增字段-2017-11-7-PLF
        //        订单编号 LineId
        //生产数量 MainQty
        //MRP净算量 SubQty
        //产品 PartName
        //订单日期 ScheduleDate
        //计划开工日期 PlanStartDate
        //计划完工日期 PlanEndDate
        //交货日期 RequireDate
        //销售订单号 CustomerOrder
        //客户编号 CustomerCode
        //类型 Reserved1 

        /// <summary>
        /// 客户编号
        /// </summary>
        public string CustomerCode { get; set; }

        /// <summary>
        /// 销售订单号
        /// </summary>
        public string CustomerOrder { get; set; }

        /// <summary>
        /// MRP净算量
        /// </summary>
        public decimal SubQty { get; set; }

        /// <summary>
        /// 订单日期
        /// </summary>
        public DateTime ScheduleDate { get; set; }

        /// <summary>
        /// 计划开工日期
        /// </summary>
        public DateTime PlanStartDate { get; set; }

        /// <summary>
        /// 交货日期
        /// </summary>
        public DateTime RequireDate { get; set; }

        /// <summary>
        /// 类型
        /// </summary>
        public string Reserved2 { get; set; }


        public string MoId { get; set; }

        public string MoDId { get; set; }
        #endregion

        #region 新增字段-jinfeng
        public string Free1 { get; set; }
        public string Free2 { get; set; }
        public string Free3 { get; set; }
        public string Free4 { get; set; }
        public string Free5 { get; set; }
        public string Free6 { get; set; }
        public string Free7 { get; set; }
        public string Free8 { get; set; }
        public string Free9 { get; set; }
        public string Free10 { get; set; }



        public string WhoCode { get; set; }

        public int OrderSeq { get; set; }
        public int OrderDId { get; set; }
        #endregion

        #region 新增字段-fulj

        //最终客户qz
        public string Define30 { get; set; }
        //销售订单号qz
        public string OrderCode { get; set; }
        //客户最终订单号qz
        public string cbdefine3 { get; set; }

        //子件信息
        public List<WorkOrderBomLine> WorkOrderBomLines { get; set; }

        #endregion
    }

    /// <summary>
    /// 生产订单子件
    /// </summary>
    public class WorkOrderBomLine
    {
        //子件pk
        public Int32 BomRrn { get; set; }
        //物料编码
        public string InvCode { get; set; }
        //需求数量
        public decimal LineMaxQty { get; set; }
        //单位用量
        public decimal UnitQty { get; set; }
        //工步
        public string StepName { get; set; }
        //规格
        public string MaterialSpec1 { get; set; }


    }
    public class MesMoallocate
    {
        /// <summary>
        /// 生产令单的所有子件用料资料ID 
        /// </summary>
        public int AllocateId { get; set; }
        /// <summary>
        /// 生产订单明细ID
        /// </summary>
        public int MoDId { get; set; }
        public int SortSeq { get; set; }
        /// <summary>
        /// 工序行号
        /// </summary>
        public string OpSeq { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public decimal Qty { get; set; }
        /// <summary>
        /// 存货编码
        /// </summary>
        public string InvCode { get; set; }
        /// <summary>
        /// 基本用量－分母
        /// </summary>
        public decimal BaseQtyD { get; set; }
        /// <summary>
        /// 基本用量－分子 
        /// </summary>
        public decimal BaseQtyN { get; set; }

        /// <summary>
        /// 工段-plf
        /// </summary>
        public string StepName { get; set; }

        /// <summary>
        /// 子件规格
        /// 时间：2017-12-01-plf
        /// </summary>
        public string MaterialSpec1 { get; set; }

        public int ByproductFlag { get; set; }

        public int ProductType { get; set; }
    }

    public class WmsOrder
    {
        public WmsOrder()
        {
            MesOrders = new List<MesOrder>();
        }
        public List<MesOrder> MesOrders { get; set; }
        public List<MesMoallocate> MesMoallocates { get; set; }
    }

    public class WorkOrderBomLinesItem
    {
        /// <summary>
        /// 
        /// </summary>
        public int BomRrn { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string WoId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string InvCode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public decimal UnitQty { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public decimal LineMaxQty { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string StepName { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string MaterialSpec1 { get; set; }

       // public int ByproductFlag { get; set; }
        public int ProductType { get; set; }
    }

    public class DataItem
    {
        public string ApprovedDate { get; set; }
        public string ApprovedUser { get; set; }
        public string Cbdefine14 { get; set; }
        public string Cbdefine19 { get; set; }
        public string Cbdefine3 { get; set; }
        public string Cbdefine4 { get; set; }
        public string Cbdefine6 { get; set; }
        public string Comments { get; set; }
        public string CreatedDate { get; set; }
        public string CreatedUser { get; set; }
        public string CustomerCode { get; set; }
        public string CustomerOrder { get; set; }
        public string CustomerPartId { get; set; }
        public string Define30 { get; set; }
        public string DocStatus { get; set; }
        public string free1 { get; set; }
        public string free10 { get; set; }
        public string free2 { get; set; }
        public string free3 { get; set; }
        public string free4 { get; set; }
        public string free5 { get; set; }
        public string free6 { get; set; }
        public string free7 { get; set; }
        public string free8 { get; set; }
        public string free9 { get; set; }
        public string IsAutoInWh { get; set; }
        public string LineId { get; set; }
        public decimal MainQty { get; set; }
        public string OrderCode { get; set; }
        public string PartName { get; set; }
        public string PlanEndDate { get; set; }
        public string PlanStartDate { get; set; }
        public string RequireDate { get; set; }
        public string Reserved1 { get; set; }
        public string Reserved2 { get; set; }
        public string ScheduleDate { get; set; }
        public decimal SubQty { get; set; }
        public string WhoCode { get; set; }
        public List<WorkOrderBomLinesItem> WorkOrderBomLines { get; set; }

    }

    public class Root
    {
        /// <summary>
        /// 
        /// </summary>
        public string orgcode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string primarykey { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int operation { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public List<DataItem> data { get; set; }
    }

}
